package com.google.code.mybatis.generator.plugins.gen;

import com.google.code.mybatis.generator.plugins.gen.User;
import com.google.code.mybatis.generator.plugins.gen.UserExample;
import java.util.List;
import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

@CacheNamespace(
implementation=org.mybatis.caches.ehcache.LoggingEhcache.class,eviction=org.apache.ibatis.cache.decorators.LruCache.class,flushInterval=100,size=100
)
public interface UserMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_USER
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @SelectProvider(type=UserSqlProvider.class, method="countByExample")
    @Options(fetchSize=1,timeout=0,useCache=true,flushCache=true)
    int countByExample(UserExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_USER
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @DeleteProvider(type=UserSqlProvider.class, method="deleteByExample")
    @Options(fetchSize=1,timeout=0,useCache=true,flushCache=true)
    int deleteByExample(UserExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_USER
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @Delete({
        "delete from T_USER",
        "where ID = #{id,jdbcType=BIGINT}"
    })
    @Options(fetchSize=1,timeout=0,useCache=true,flushCache=true)
    int deleteByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_USER
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @Insert({
        "insert into T_USER (USERNAME, alias, ",
        "PASSWORD, EMAIL)",
        "values (#{username,jdbcType=VARCHAR}, #{alias,jdbcType=VARCHAR}, ",
        "#{password,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id",fetchSize=1,timeout=0,useCache=true,flushCache=true)
    int insert(User record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_USER
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @InsertProvider(type=UserSqlProvider.class, method="insertSelective")
    @Options(useGeneratedKeys=true,keyProperty="id",fetchSize=1,timeout=0,useCache=true,flushCache=true)
    int insertSelective(User record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_USER
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @SelectProvider(type=UserSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="ID", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="USERNAME", property="username", jdbcType=JdbcType.VARCHAR),
        @Result(column="alias", property="alias", jdbcType=JdbcType.VARCHAR),
        @Result(column="PASSWORD", property="password", jdbcType=JdbcType.VARCHAR),
        @Result(column="EMAIL", property="email", jdbcType=JdbcType.VARCHAR)
    })
    @Options(fetchSize=1,timeout=0,useCache=true,flushCache=true)
    User selectOnlyOneByExample(UserExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_USER
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @SelectProvider(type=UserSqlProvider.class, method="selectByExampleDecorated")
    @Results({
        @Result(column="ID", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="USERNAME", property="username", jdbcType=JdbcType.VARCHAR),
        @Result(column="alias", property="alias", jdbcType=JdbcType.VARCHAR),
        @Result(column="PASSWORD", property="password", jdbcType=JdbcType.VARCHAR),
        @Result(column="EMAIL", property="email", jdbcType=JdbcType.VARCHAR)
    })
    @Options(fetchSize=1,timeout=0,useCache=true,flushCache=true)
    List<User> selectByExampleDecorated(UserExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_USER
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @SelectProvider(type=UserSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="ID", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="USERNAME", property="username", jdbcType=JdbcType.VARCHAR),
        @Result(column="alias", property="alias", jdbcType=JdbcType.VARCHAR),
        @Result(column="PASSWORD", property="password", jdbcType=JdbcType.VARCHAR),
        @Result(column="EMAIL", property="email", jdbcType=JdbcType.VARCHAR)
    })
    @Options(fetchSize=1,timeout=0,useCache=true,flushCache=true)
    List<User> selectByExample(UserExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_USER
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @Select({
        "select",
        "ID, USERNAME, alias, PASSWORD, EMAIL",
        "from T_USER",
        "where ID = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="ID", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="USERNAME", property="username", jdbcType=JdbcType.VARCHAR),
        @Result(column="alias", property="alias", jdbcType=JdbcType.VARCHAR),
        @Result(column="PASSWORD", property="password", jdbcType=JdbcType.VARCHAR),
        @Result(column="EMAIL", property="email", jdbcType=JdbcType.VARCHAR)
    })
    @Options(fetchSize=1,timeout=0,useCache=true,flushCache=true)
    User selectByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_USER
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @UpdateProvider(type=UserSqlProvider.class, method="updateByExampleSelective2")
    @Options(fetchSize=1,timeout=0,useCache=true,flushCache=true)
    int updateByExampleSelective2(@Param("record") User record, @Param("example") UserExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_USER
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @UpdateProvider(type=UserSqlProvider.class, method="updateByExampleSelective")
    @Options(fetchSize=1,timeout=0,useCache=true,flushCache=true)
    int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_USER
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @UpdateProvider(type=UserSqlProvider.class, method="updateByExample")
    @Options(fetchSize=1,timeout=0,useCache=true,flushCache=true)
    int updateByExample(@Param("record") User record, @Param("example") UserExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_USER
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @UpdateProvider(type=UserSqlProvider.class, method="updateByPrimaryKeySelective")
    @Options(fetchSize=1,timeout=0,useCache=true,flushCache=true)
    int updateByPrimaryKeySelective(User record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_USER
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @Update({
        "update T_USER",
        "set USERNAME = #{username,jdbcType=VARCHAR},",
          "alias = #{alias,jdbcType=VARCHAR},",
          "PASSWORD = #{password,jdbcType=VARCHAR},",
          "EMAIL = #{email,jdbcType=VARCHAR}",
        "where ID = #{id,jdbcType=BIGINT}"
    })
    @Options(fetchSize=1,timeout=0,useCache=true,flushCache=true)
    int updateByPrimaryKey(User record);
}